﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Age.Qna.Site.Mvc.Models
{
  public class Question
  {
    public Question() { }

    public int Save(Qnawsvc.QnaEntity entity)
    {

      Qnawsvc.QnaWSvcClient client = new Qnawsvc.QnaWSvcClient("ws"); // TODO[P2]: Use a global endpoint name (webconfig?)

      int a = client.SetQuestionAndAnswer(entity);

      if (a > 0)
      {
        //TODO[P1]: Extend save

      }
      else
      {
        //TODO[P2]: Handle errors of save Qna.
      }

			return a;

    }

    public string RenderQuestionTextArea(int id)
    {
      string html = string.Empty;
      string question = string.Empty;

      // fetch data from db;
      if (id > 0) question = "data from db";
      

      
      return html;
    }
  }
}